package com.han.yrpc.core.provider;

import org.springframework.stereotype.Component;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@Component
public class ServiceCache {

    private final Map<String, Object> serviceCacheMap = new ConcurrentHashMap<>();

    public void addService(String serviceName, Object object) {
        serviceCacheMap.putIfAbsent(serviceName, object);
    }

    public Object getService(String serviceName) {
        return serviceCacheMap.get(serviceName);
    }

}
